package com.jyserver.common.AutoCode.jybaits.element.pc.From;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.jyserver.common.utils.HelpUtils;

public class Radio {
    public static String getStyle(String label, Object prop, String key, JSONArray radiosArray) {
        String validate = "";
        if (HelpUtils.isNotEmpty(prop)) {
            prop = "prop=\"" + prop + "\"";
        } else {
            prop = "";
        }
        String radios = "";
        try {
            for (int i = 0; i < radiosArray.size(); i++) {
                JSONObject jsonObject = JSONObject.parseObject(String.valueOf(radiosArray.get(i)));
                radios = radios + "<el-radio label=\"" + jsonObject.get("label") + "\" value=\"" + jsonObject.get("value") + "\"></el-radio>\n";
            }
        } catch (Exception e) {

        }
        try {
            return "<el-form-item label=\"" + label + "\" :label-width=\"formLabelWidth\" " + prop + ">\n" + "<el-radio-group v-model=\"Dataform." + key + "\">\n" + radios +
                    "</el-radio-group>\n"+
                    "</el-form-item>\n";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }

}